<template>
  <!-- 输入类型的值 -->
  <div class="flex items-center w-full">
    <mci-input v-model="inputVal" :maxlength="INPUT_MAX" class="w-full" @update:model-value="updateValue" />
  </div>
</template>

<script lang="ts" setup>
import { MciInput } from '@/components/base';
import { ref, watch } from 'vue';
import { INPUT_MAX } from './data';

const props = defineProps<{
  condValue: any;
}>();

const emit = defineEmits(['valueChange']);

watch(
  [() => props.condValue],
  ([newCondValue]) => {
    inputVal.value = newCondValue;
  },
  { deep: true }
);

const inputVal = ref<any>(props.condValue);

// 更新值
const updateValue = (val: any) => {
  emit('valueChange', val);
};
</script>
